from django.db import models
from doctor.models import Doctor
from patient.models import Patient
from appointment.models import Appointment
# Create your models here.
class Prescription(models.Model):

    description  = models.TextField(null=True,blank=True)

    status = models.CharField(max_length=255,null=True,blank=True)

    take_status = models.CharField(
        max_length=20,
        choices=[
            ('take', '已取'),
            ('untake', '未取'),

        ],
        default='untake'
    )

    time = models.DateTimeField(auto_now_add=True)

    patient_id = models.ForeignKey(Patient, on_delete=models.CASCADE)

    doctor_id = models.ForeignKey(Doctor, on_delete=models.CASCADE)

    appointment = models.OneToOneField(Appointment, on_delete=models.CASCADE,related_name='prescription')
